import request from '@/utils/request'
// !RESTful接口规范：5个标准格式组成
// 新增 post    body[data]   /api/news/book
// 修改 put     body[data]   /api/news/book/修改的id
// 删除 delete  body[data]   /api/news/book/删除的id
// 查询 get
// 查询列表     query[params] /api/news/book/
// 查询单个                   /api/news/book/查询id
/**
 * 查询列表
 * @param {*} params
 * @returns
 */
export const getRoleListApi = (params) => {
  return request({
    url: '/sys/role',
    method: 'get',
    params
  })
}

/**
 * 查询单个
 * @param {*} id
 * @returns
 */
export const getRoleInfoApi = (id) => {
  return request({
    url: '/sys/role/' + id,
    method: 'get'
  })
}
/**
 * 添加
 * @param {*} data
 * @returns
 */
export const addRoleApi = (data) => {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}
/**
 * 修改
 * @param {*} data
 * @returns
 */
export const editRoleApi = (data) => {
  return request({
    url: '/sys/role/' + data.id,
    method: 'put',
    data
  })
}
/**
 * 删除
 * @param {*} id
 * @returns
 */
export const delRoleApi = (id) => {
  return request({
    url: '/sys/role/' + id,
    method: 'delete'
  })
}

export const getCompanyInfoApi = (id) => {
  return request({
    url: '/company/' + id
  })
}

export const setRoleAuthApi = (data) => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
